<?php

/**
 * DISABLE
 */

die('DISABLE');

include 'common.php';
$username = $_COOKIE['username'];
$token = $_COOKIE['token'];
$msg = $_REQUEST['msg'];

chksymbol($username);
chksymbol($token);
chksymbol($msg);

//$conn = connect2db();
$result = mysql_query("select * from userinfo where username='$username' and token='$token'");
$row = mysql_fetch_array($result);

if($row)
{
	$addr = $_SERVER['REMOTE_ADDR'];
	$time = time();
	mysql_query("set msg utf8");
	$result2 = mysql_query("insert into usermsg (username, msg, lasttime) values ('$username', '$msg', '$time')");
	safelog($username, 'UPLOAD_MSG', $conn);
	if($result2)
		$errorcode = 1;
}else
{
	$errorcode = 5;
}
echo json_encode(array('errorcode'=>$errorcode));
mysql_free_result($result);
mysql_close($conn);

?>